
var f1=f2=f3=f4=f5=f6=0
function check_username(x){
    var check=/^.{3,8}$/
    var span=document.getElementById("check_username")
    if(check.test(x)==false){
        f1=0
        span.innerHTML="<font color=red size=1px>X</font>"
    }else{
        f1=1
        span.innerHTML="<font color=green size=1px>√</font>"
    }
}
function check_pwd1(x){
    var check=/^.{8,16}$/
    var span=document.getElementById("check_pwd1")
    if(check.test(x)==false){
        f2=0
        span.innerHTML="<font color=red size=1px>X</font>"
    }else{
        f2=1
        span.innerHTML="<font color=green size=1px>√</font>"
    }

}
function check_pwd2(){ 
    var span1=document.getElementById("pwd1").value
    var span2=document.getElementById("pwd2").value
    var span=document.getElementById("check_pwd2")
    if(span1 != span2 ){
        f3=0
        span.innerHTML="<font color=red size=1px>X</font>"
    }else{
        f3=1
        span.innerHTML="<font color=green size=1px>√</font>"
    }
    if(span2==""){
        f3=0
        span.innerHTML="<font color=red size=1px>X</font>"
    }
}
function check_phone(x){
    var check=/(^1[3|4|5|7|8]\d{9}$)/
    var span=document.getElementById("check_phone")
    if(check.test(x)==false){
        f4=0
        span.innerHTML="<font color=red size=1px>X</font>"
    }else{
        f4=1
        span.innerHTML="<font color=green size=1px>√</font>"
    }
    }
     
    function check_code(x){
        var span=document.getElementById("check_code")
       var check=/^.{5}$/
       if(check.test(x)==false){
        f5=0
        span.innerHTML="<font color=red size=1px>X</font>"
    }else{
        f5=1
        span.innerHTML="<font color=green size=1px >√</font>"
    }
    }
    function check_email(my_value){
        var check=/^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.+[a-zA-Z0-9]+$/
        var span=document.getElementById("check_email")
        if(check.test(my_value)==false){
            f6=0
            span.innerHTML="<font color=red size=1px>X</font>"
        }else{
            f6=1
        span.innerHTML="<font color=green size=1px >√</font>"
        }
    }

    function check_submit(){
            if(f1&&f2&&f3&&f4&&f5&&f6){
                alert("注册成功!即将跳转登录页面")
                window.open="https://chat.chat826.com/#/home"
            }else{
                alert("填写不规范或有未填写内容，请重新填写")
            }
    }